package org.example.usercontroller;

import lombok.extern.slf4j.Slf4j;
import org.example.pojo.Result;
import org.example.pojo.entity.Order;
import org.example.pojo.userdto.ShoppingAddressDTO;
import org.example.userservice.ShoppingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/user/shopping")
@Slf4j
public class ShoppingController {

    @Autowired
    private ShoppingService shoppingService;
    @PostMapping
    public Result order(@RequestBody ShoppingAddressDTO shoppingAddressDTO) {
        if(shoppingService.order(shoppingAddressDTO.getAddressid())){
            return Result.success();
        }else{
            return Result.error("非法地址！");
        }

    }

}
